package hk.m4s.lr.repair.test.service.notice;

import android.content.Context;

import java.util.Map;

import framework.common.zanetwork.AcountUeHttpUrl;
import framework.common.zanetwork.UeHttpUrl;
import framework.common.zanetwork.core.HttpCallback;
import framework.common.zanetwork.core.ResponseCallback;
import hk.m4s.lr.repair.test.model.NoticeModelResult;
import hk.m4s.lr.repair.test.model.PushModelResult;
import hk.m4s.lr.repair.test.service.BaseService;
import okhttp3.Response;

/**
 * Created by qi.wang on 2017/4/1.
 */

public class NoticeService extends BaseService{
    public static void userPushSetList (final Context context, Map<String, Object> parmas, final ResponseCallback<PushModelResult> callback) {

        httpHelper.post(UeHttpUrl.userPushSetList(), parmas, new HttpCallback<PushModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, PushModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void userPushSetUpdate (final Context context, Map<String, Object> parmas, final ResponseCallback<Map> callback) {

        httpHelper.post(UeHttpUrl.userPushSetUpdate(), parmas, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, Map o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void sysNoticeList (final Context context, Map<String, Object> parmas, final ResponseCallback<NoticeModelResult> callback) {

        httpHelper.post(AcountUeHttpUrl.sysNoticeList(), parmas, new HttpCallback<NoticeModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, NoticeModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void sysNoticeRead (final Context context, Map<String, Object> parmas, final ResponseCallback<NoticeModelResult> callback) {

        httpHelper.post(AcountUeHttpUrl.sysNoticeRead(), parmas, new HttpCallback<NoticeModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, NoticeModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
}
